(function() {
	'strict';
	define('c', ['jquery', 'echarts'], function($, echarts) {
		function barOrLine(option) {
			var legendData = option.legendData,
				xAxisData = option.xAxisData,
				yAxisData = option.yAxisData,
				xType = option.xType==undefined?'category':option.xType,
				yType = option.yType==undefined?'value':option.yType,
				seriesName = option.seriesName,
				seriesData = option.seriesData,
				type = option.type, //chart的类型： bar, line
				barWidth = option.barWidth,
				chartWrapperId = option.chartWrapperId,
				i = 0, l = seriesName.length,
				series = [];

			if(seriesName.length < 1) {
				return null;
			}
			
			var chartWrapper = echarts.init(document.getElementById(chartWrapperId));
			
			var defaultOption = {
					color: ['#C23531','#1A2E4D'],
					tooltip : {
				        trigger: 'axis'
				    },
				    grid: {
				        left: '4%',
				        right: '3%',
				        bottom: '9%',
				        containLabel: true
				    },
				    legend: {
				        data: legendData,
				        textStyle:{
							color: '#EEE',
							fontSize:14
						}
				    },
				    calculable : true,
				    xAxis : [
				        {
				            type : xType,
				            data : xAxisData,
				            axisLabel: {
					            inside: false,
					            textStyle: {
					                color: '#EEE',
					                fontSize:14
					            }
					        },
					        axisTick: {
					            show: false
					        },
					        axisLine: {
					            show: false
					        },
					        z: 10
				        }
				    ],
				    yAxis : [
				        {
				        	type : yType,
				            data : yAxisData,
				        	axisLine: {
					            show: false
					        },
					        axisTick: {
					            show: false
					        },
					        axisLabel: {
					            textStyle: {
					                color: '#EEE',
					                fontSize:14
					            }
					        }
				        }
				    ],
				    dataZoom: [
				        {
				            type: 'inside'
				        }
				    ]
			};
			
			if(l == 1) {
				defaultOption.series = {
					name: seriesName,
		            type: type,
		            data: seriesData
				};
				if(barWidth) {
					defaultOption.series.barWidth = barWidth;
				}
			} else {
				for(i=0; i<l; i++) {
					series.push({
						name: seriesName[i],
			            type: type,
			            data: seriesData[i]			            
					});
					if(barWidth) {
						series[i].barWidth = barWidth;
					}
				}
				defaultOption.series = series;
			}
			
			chartWrapper.setOption(defaultOption);
		}
		
		/*饼图*/
		function pie(option) {
			var seriesName = option.seriesName,
				seriesData = option.seriesData,
				text = option.text==undefined?'':option.text,
				roseType = option.roseType==undefined?'angle':option.roseType,
				isShow = option.isShow==undefined?'true':option.isShow,		
				chartWrapperId = option.chartWrapperId;
			var formatter = "";
			if(option.formatter == null){
				formatter = "{b} \n \n {c} ({d}%)";
			}else{
				formatter = option.formatter;
			}
			var chartWrapper = echarts.init(document.getElementById(chartWrapperId));
			var defaultOption = {
					textStyle: {
                        color: '#eee',
                        fontSize: 16
                    },
					color: [
					    '#61A0A8',
					    '#D48265',
					    '#6A1512',
						'#666633',
						'#CA8622',
						'#C23531',
				        ],
				    series : [
				        {
				            name:seriesName,
				            type:'pie',
				            radius : '60%',
				            center: ['50%', '50%'],
				            data:seriesData.sort(function (a, b) { return a.value - b.value; }),
				            roseType: roseType,
				            label: {
				                normal: {
				                	show:isShow,
				                	formatter: formatter,
				                }
				            },
				            labelLine: {
				                normal: {
				                    lineStyle: {
				                        color: '#EEE'
				                    },
				                    smooth: 0.2,
				                    length: 10,
				                    length2: 20,
				                    show:isShow
				                }
				            },
				            itemStyle: {
				                normal: {
				                    shadowBlur: 200,
				                    shadowColor: 'rgba(0, 0, 0, 0.5)'
				                }
				            }
				        }
				    ]
				};
			chartWrapper.setOption(defaultOption);
		}
	
		/*嵌套环形图*/
		function nestLoop(option) {
			var seriesName1 = option.seriesName1,
				seriesName2 = option.seriesName2,
				seriesData1 = option.seriesData1,
				seriesData2 = option.seriesData2,
				chartWrapperId = option.chartWrapperId;
			var nestLoopChart = echarts.init(document.getElementById(chartWrapperId));
			var option = {
					color: [
						'#61A0A8',
						'#6A1512',
						'#666633',
						'#CA8622',
						'#C23531',
						'#D48265',
			        ],
					textStyle: {
			        	color: '#EEE',
			        	fontSize: 16
		        	},
		        	  grid: {
		                bottom: '0.5%',
		                containLabel: true
		            },
				    tooltip: {
				        trigger: 'item',
				        formatter: "{b} <br/> {c} ({d}%)"
				    },
				    series: [
				        {
				            name:seriesName1,
				            type:'pie',
				            selectedMode: 'single',
				            radius: [0, '35%'],
				            label: {
				                normal: {
				                    position: 'inner'
				                }
				            },
				            labelLine: {
				                normal: {
				                    show: false
				                }
				            },
				            data:seriesData1
				        },
				        {
				            name:seriesName2,
				            type:'pie',
				            radius: ['45%', '60%'],
				            label: {
				                normal: {
				                	formatter: "{b} \n \n {c} ({d}%)"
				                }
				            },
				            data:seriesData2
				        }
				    ]
				};
			nestLoopChart.setOption(option);
		}
		
		//环型
		function annular(option) {
			var seriesName = option.seriesName,
				seriesData = option.seriesData,
				chartWrapperId = option.chartWrapperId;
			var annularChart = echarts.init(document.getElementById(chartWrapperId));
			var formatter = "";
			if(option.formatter == null){
				formatter = "{b} \n \n {c} ({d}%)";
			}else{
				formatter = option.formatter;
			}
			var option = {
				textStyle: {
                    color: '#eee',
                    fontSize: 16
                },
			    color: [
					'#C23531',
					'#CA8622',
			        '#61A0A8',
					'#6A1512',
					'#666633',
					'#D48265',
			        ],
		        grid: {
		        	top:10,
	                containLabel: true
	            },
			    series: [
			        {
			            name:seriesName,
			            type:'pie',
			            radius: ['40%', '60%'],
			            avoidLabelOverlap: false,
			            label: {
			                normal: {
			                    show: false,
			                    position: 'center'
			                },
			                emphasis: {
			                    show: true,
			                    textStyle: {
			                        fontSize: '24',
			                        fontWeight: 'bold'
			                    }
			                }
			            },
			            label: {
			                normal: {
			                    formatter: formatter
			                }
			            },
			            labelLine: {
			                normal: {
			                    show: true
			                }
			            },
			            data:seriesData
			        }
			    ]
			};
			annularChart.setOption(option);
		}
		
		//矩形图
		function rect(option) {
			var seriesName = option.seriesName,
				seriesData = option.seriesData,
				chartWrapperId = option.chartWrapperId;
			var rectChart = echarts.init(document.getElementById(chartWrapperId));
			option = {
					color:[
					       '#CA8622',
					       '#D48265',
					       '#749F83',
					       '#61A0A8',
					       '#C23531',
					       '#1A2E4D',
					       '#666633',
					       '#7E5517',
					       '#6A1512'
					   ],
				    tooltip : {
				        trigger: 'item',
				        formatter: "{b} : {c}"
				    },
				    
				    series : [
				      {
			            name:seriesName,
			            type:'treemap',
			            breadcrumb:{
					    	show:false
					    },
					    top:10,
			            itemStyle: {
			                normal: {
			                    label: {
			                        show: true,
			                        formatter: "{b} : {c}"
			                    }, 
			                    borderWidth: 1
			                },
			                emphasis: {
			                    label: {
			                        show: true
			                    }
			                }
			            },
			            data:seriesData
				      }
				    ]
				};
			rectChart.setOption(option);                    
		} 
		
		//面积图
		function area(option){
			var legendData = option.legendData,
			xAxisData = option.xAxisData,
			seriesName = option.seriesName,
			seriesData = option.seriesData,
			stack = option.stack,
			l = seriesName.length,
			type = option.type,
			chartWrapperId = option.chartWrapperId,
			series = [];
		if(l< 1) {
			return null;
		}
		for(var i=0;i<l;i++){
			series.push({
				name: seriesName[i],
	            type: type,
	            stack: stack,
	            areaStyle: {normal: {}},
	            data: seriesData[i]
			});
		}
		var areaChart = echarts.init(document.getElementById(chartWrapperId));
		option = {
				color: [
					'#CA8622',
					'#C23531',
					'#61A0A8',
					'#6A1512',
					'#666633',
					'#D48265',
			        ],
			    tooltip : {
			        trigger: 'axis'
			    },
			    grid: {
			    	bottom: '10%',
			        left: '2.5%',
			        right: '5%',
			        containLabel: true
			    },
			    legend: {
			        data:legendData,
			        textStyle:{
						color: '#EEE',
						fontSize:14
					},
					left:50,
					right:10
			    },
			    xAxis : [
			        {
			            type : 'category',
			            boundaryGap : false,
			            data : xAxisData,
			            axisLabel:{
				        	textStyle:{
				        		color:'#EEE'
				        	}
				        }
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value',
			            axisLabel:{
				        	textStyle:{
				        		color:'#EEE'
				        	}
				        }
			        }
			    ],
			    series:series
			};
			areaChart.setOption(option);
		}
		
		//正负条形图 Positive and negative bars
		function PNBars(option) {
			var seriesName1 = option.seriesName1,
				seriesName2 = option.seriesName2,
				legendData = option.legendData,
				seriesData1 = option.seriesData1,
				seriesData2 = option.seriesData2,
				yData = option.yData,
				chartWrapperId = option.chartWrapperId;
			var chart = echarts.init(document.getElementById(chartWrapperId));
			var option = {
					color: ['#C23531','#1A2E4D'],
				    tooltip : {
				        trigger: 'axis',
				        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				            type : 'shadow',       // 默认为直线，可选为：'line' | 'shadow'
				            lineStyle:{
				            	color:'#4D4D4D'
				            }
				        }
				    },
				    legend: {
				        data: legendData,
				        textStyle:{
				        	color:'#E3E3E3',
				        	fontSize:14
				        }
				    },
				    grid: {
				        left: 2,
				        bottom: 30,
				        containLabel: true
				    },
				    xAxis : [
				        {
				            type : 'value',
				            formatter:function(v){return Math.abs(v);},
				            axisLabel: {
				            	formatter:function(v){return Math.abs(v);},
	                            textStyle: {
	                                color: '#E3E3E3',
	                            },
	                        },
	                        interval:0,
	                        grid: {
	    				        left: 2,
	    				        bottom: 30,
	    				        containLabel: true
	    				    },
	                        axisLine:{
	                        	lineStyle:{
	                        		color:'#4D4D4D'
	                        	}
	                        },
	                        /* 分割线 */
	                        splitLine:{
	                        	lineStyle:{
	                        		color:'#4D4D4D'
	                        	}
	                        },
				        }
				    ],
				    yAxis : [
				        {
				            type : 'category',
				            axisTick : {
				            	show: false
				            },
				            axisLabel: {
	                            textStyle: {
	                                color: '#E3E3E3'
	                            }
	                        },
	                        axisLine:{
	                        	lineStyle:{
	                        		color:'#4D4D4D'
	                        	}
	                        },
				            data : yData
				        }
				    ],
				    series : [
				        {
				            name: seriesName1,
				            type: 'bar',
				            stack: '总人数',
				            label: {
				                normal: {
				                    show: true
				                }
				            },
				            data: seriesData1
				        },
				        {
				            name: seriesName2,
				            type: 'bar',
				            stack: '总人数',
				            label: {
				                normal: {
				                    show: true,
				                    position: 'inside',
				                    formatter:function(v){return Math.abs(v.data);}
				                }
				            },
				            data: seriesData2
				        }
				    ]
				};
			chart.setOption(option);
		}
		
		/*柱形图加折线图*/
		function barAndLine(option) {
			var legendData = option.legendData,
				xAxisData = option.xAxisData,
				seriesData1 = option.seriesData1,
				seriesData2 = option.seriesData2,
				seriesData3 = option.seriesData3,
				seriesName1 = option.seriesName1,
				seriesName2 = option.seriesName2,
				seriesName3 = option.seriesName3,
				chartWrapperId = option.chartWrapperId;
			var chart = echarts.init(document.getElementById(chartWrapperId));
			var option = {
				color: ['#C23531','#1A2E4D'],
		        textStyle: {
		        	color: '#EEE'
	        	},
			    tooltip: {
			        trigger: 'axis'
			    },
			    legend: {
			        data:legendData,
			        textStyle:{
			        	color:'#EEE'
			        }
			    },
			    xAxis: [
			        {
			            type: 'category',
			            axisLabel:{'interval':0},
			            data: xAxisData,
			            splitLine: {show: false}
			        }
			    ],
			    yAxis: [
			        {
			            type: 'value',
			            name: seriesName1,
			            min: 0,
			            max: 250,
			            interval: 50,
			            axisLabel: {
			                formatter: '{value}',
			            }
			        },
			        {
			            type: 'value',
			            name: seriesName2,
			            min: 0,
			            max: 25,
			            interval: 5,
			            axisLabel: {
			                formatter: '{value}',
			            }
			        }
			    ],
			    series: [
			        {
			            name:seriesName1,
			            type:'bar',
			            data:seriesData1
			        },
			        {
			            name:seriesName2,
			            type:'bar',
			            data:seriesData2
			        },
			        {
			            name:seriesName3,
			            type:'line',
			            yAxisIndex: 0,
			            data:seriesData3
			        }
			    ]
			};
			chart.setOption(option);
		}
		
		/*散点图*/
		function scatters(option) {
			var legendData = option.legendData, legendLen = legendData.length,
				seriesData = option.seriesData, seriesLen = seriesData.length,
				yAxisData = option.yAxisData, i = 0;
			var chartWrapperId = option.chartWrapperId;
			var chart = echarts.init(document.getElementById(chartWrapperId));
			var options = {
					color: ['#C23531','#CA8622'],
				    grid: {
				        left: '1%',
				        right: '5%',
				        bottom: 30,
				        containLabel: true
				    },
				    tooltip : {
				        trigger: 'axis',
				        showDelay : 0,
				        formatter : function (params) {
				            if (params.value.length > 1) {
				                return params.seriesName + ' :<br/>'
				                   + params.value[0] + '岁 '
				                   + params.value[1];
				            }
				            else {
				                return params.seriesName + ' :<br/>'
				                   + params.name + ' : '
				                   + params.value + '岁 ';
				            }
				        },
				        axisPointer:{
				            show: true,
				            type : 'cross',
				            lineStyle: {
				                type : 'dashed',
				                width : 1
				            }
				        }
				    },
				    legend: {
				        data: legendData,
				        left: 'center',
				        textStyle:{
				        	color:'#EEE',
				        	fontSize:14
				        }
				    },
				    xAxis : [
				        {
				            type : 'value',
				            scale: true,
				            min: '15',
				            axisLabel : {
				                formatter: '{value} 岁',
				                textStyle: {
	                                color: '#EEE',
	                            },
				            },
				            axisLine:{
	                        	lineStyle:{
	                        		color:'#4D4D4D'
	                        	}
	                        },
				            splitLine: {show: false}
				        }
				    ],
				    yAxis : [
				        {
				            type : 'category',
				            scale:true,
				            axisLabel : {
				                textStyle: {
	                                color: '#EEE'
	                            }
				            },
				            axisLine:{
	                        	lineStyle:{
	                        		color:'#4D4D4D'
	                        	}
	                        },
				            splitLine: {show: false},
				            data: yAxisData
				        }
				    ],
				    series : []
				};
			if(legendLen != seriesLen) {
				return;
			}
			for(i=0; i<seriesLen; i++) {
				options.series[i] = {
			            name: legendData[i],
			            type:'scatter',
			            data: seriesData[i],
			            markArea: {
			                silent: true,
			                itemStyle: {
			                    normal: {
			                        color: 'transparent',
			                        borderWidth: 1,
			                        borderType: 'dashed'
			                    }
			                },
			                data: [[{xAxis: 'min', yAxis: 'min'}, 
			                        {xAxis: 'max',yAxis: 'max'}]]
			            },
			            markPoint : {
			                data : [
			                    {type : 'max', name: '最大值'},
			                    {type : 'min', name: '最小值'}
			                ]
			            },
			            markLine : {
			                lineStyle: {normal: {type: 'solid'}},
			                data : [{type : 'average', name: '平均值'}]
			            }
			        };
			}
			chart.setOption(options);
		}
		
		//进度条
		function progressBar(option){
			var cityData = option.cityData,
			progressData = option.progressData,
			chartWrapperId = option.chartWrapperId,
			legendData = option.legendData,
			seriesName = option.seriesName,
			barWidth = option.barWidth,
			ydata=[];
			for(var j=0;j<cityData.length;j++){
				ydata.push(100);
			}	
			var chart = echarts.init(document.getElementById(chartWrapperId));
		
		var option = {
				tooltip : {
					trigger: 'item',
					axisPointer : {            
						type : 'shadow'        
					},
					formatter: "{b}: {c}%"
				},
				grid: {
			        left:75,
			        top:35,
			        right: 40
			    },
				legend: {
					data: legendData,
					textStyle:{
						color:'#EEE',
						fontSize:14
					}
				},
				xAxis:  {
					type: 'value',
					axisLine:{
						lineStyle:{//修改线条颜色
							color:'#EEE'
						}
					},
					axisLabel: {
			            textStyle: {
			                color: '#EEE',
			                fontSize:14
			            }
			        }
				},
				yAxis:[ 
			        {
						type: 'category',
						data: cityData,
						axisLine:{
							lineStyle:{//修改线条颜色
								color:'#EEE'
							}
						},
						axisLabel: {
				            textStyle: {
				                color: '#EEE',
				                fontSize:14
				            },
				            'interval':0//设定标签全部显示
				        }
			        },
			        {
			        	show:false,
			        	data:cityData,
			        	axisLine:{
		          	      	lineStyle:{//修改线条颜色
		          	      		color:'#EEE'
		          	      	}
			        	}
			        }
		       ],
		       series: [
		            {
		        	 // 辅助系列
		            	type: 'bar',
		            	silent: true,
		            	yAxisIndex: 1,
		            	itemStyle: {
		            		normal: {
		            			barBorderRadius: 20,
		            			color: 'rgba(221,221,221,0.8)'       
		            		}
		            	},
			            barWidth: barWidth,//单个柱的宽度
			            data:ydata
		            }, {
		       	   	  	name:seriesName,
		       	   	  	type: 'bar',
		       	   	  	data: progressData,
		       	   	  	barWidth: barWidth,
		       	   	  	itemStyle: {
		       	   	  		normal: {
		       	   	  			barBorderRadius: 20,
		       	   	  			color: '#597FB8',
		       	   	  			shadowColor: 'rgba(0, 0, 0, 0.4)',
		       	   	  			shadowBlur: 20,
		       	   	  			fontSize:14
		       	   	  		}
		       	   	  	}
		            }
	            ]
			}; 
			chart.setOption(option);
	    
			/*setInterval(function (){
				switch(x%8){
    	   			case 0:
	    	   			ydata = [];numData=[];
	    	   			for(j=0;j<8;j++){
	    	   				ydata.push(cityData[j]);
	    	   				numData.push(progressData[j]);
	    	   			}
	    	   			break;
	    	   		case 1:
	    	   			ydata = [];numData=[];
	    	   			for(j=8;j<16;j++){
	    	   				ydata.push(cityData[j]);
	    	   				numData.push(progressData[j]);
	    	   			}
	    	   			break;
				}
				x++;
				chart.setOption({
					yAxis:[{
						data:ydata
					}],
					series: [{
						name:seriesName,
						data: numData,
					}]
				});
			}, 5000); 	*/
		}
		
		//单轴散点图 v表示竖直方向，h代表水平方向
		function singleAxisScatters(_option, position) {
		    var xAxisData = _option.xAxisData,
		    	yAxisData = _option.yAxisData,
		    	seriesData = _option.seriesData,
		    	chartWrapperId = _option.chartWrapperId;
		    var chart = echarts.init(document.getElementById(chartWrapperId));
		    var options = {};
		    if(position == "v") {
		    	seriesData = seriesData.map(function (item) {
			        return [item[1], item[0]];
			    });
		    	option = {
			    	textStyle: {color: '#EEE'},
			        title: {},
			        tooltip: {
			            position: 'top',
			            formatter: function (params) {
			                return  '年龄: ' + params.value[0] + '岁';
			            }
			        },
			        grid: {
			        	top: '5%',
			            left: '4%',
			            bottom: '10%',
			            right: '4%',
			            containLabel: true
			        },
			        xAxis: {
			            type: 'value',
			            data: xAxisData,
			            boundaryGap: false,
			            splitLine: {
			                show: true,
			                lineStyle: {
			                    color: '#999',
			                    type: 'dashed'
			                }
			            },
			            axisLabel: {
				            textStyle: {
				                color: '#EEE',
				                fontSize:14
				            },
			            },
			            axisLine: {
			                show: false
			            }
			        },
			        yAxis: {
			            type: 'category',
			            data: yAxisData,
			            axisLabel: {
				            textStyle: {
				                color: '#EEE',
				                fontSize:14
				            },
			            },
			            axisLine: {
			                show: false
			            }
			        },
			        series: [{
			            name: 'Punch Card',
			            type: 'scatter',
			            symbolSize: function (val) {
			                return val[1] * 4;
			            },
			            data: seriesData,
			            animationDelay: function (idx) {
			                return idx * 5;
			            }
			        }]
			    };
		    } else {
		    	option = {
					textStyle: {color: '#EEE'},
					grid: {
						top: 10,
				        containLabel: true
				    },
				    tooltip: {
				        position: 'top'
				    },
				    title: [],
				    singleAxis: [],
				    series: []
				};
				echarts.util.each(yAxisData, function (data, idx) {
				    option.title.push({
				        textBaseline: 'middle',
				        top: (idx + 0.3) * 100 / 5 + '%',
				        text: data,
				        textStyle: {color: '#EEE'}
				    });
				    option.singleAxis.push({
				        left: 100,
				        type: 'value',
				        data: xAxisData,
				        top: (idx + 0.2) * 100 / 5 + '%',
				        height: (100 / 5 - 15) + '%',
				        scale: true,
			            axisLabel : {
			                formatter: '{value} 岁',
			                textStyle: {
	                            color: '#EEE',
	                        },
			            },
				    });
				    option.series.push({
				        singleAxisIndex: idx,
				        coordinateSystem: 'singleAxis',
				        type: 'scatter',
				        data: [],
				        symbolSize: function (dataItem) {
				            return dataItem[0] / 3;
				        }
				    });
				});
				echarts.util.each(seriesData, function (dataItem) {
				    option.series[dataItem[0]].data.push([dataItem[1]]);
				});
		    }
			chart.setOption(option);
		}
		
		//对比柱状图
		function bar(option){
			var yData = option.yData,
			legendData = option.legendData,
			seriesName = option.seriesName,
			seriesData = option.seriesData;
			var chartWrapperId = option.chartWrapperId,
			chart = echarts.init(document.getElementById(chartWrapperId)),
			option = {
				color: ['#C23531','#1A2E4D'],
			    tooltip : {
			        trigger: 'axis',
			        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
			            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
			        }
			    },
			    legend: {
			        data: legendData,
			        textStyle:{
						color: '#EEE',
						fontSize:14
					}
			    },
			    xAxis:  {
			        type: 'value',
			        splitLine:{
			        	show:false
			        },
			        axisLine:{
				    	lineStyle:{
				    		color:'#EEE'
				    	}
				    },
			        axisLabel: {
			            textStyle: {
			                color: '#EEE',
			                fontSize:14
			            }
			        }
			    },
			    yAxis: {
			        type: 'category',
			        data: yData,
			        axisLine:{
				    	lineStyle:{
				    		color:'#EEE'
				    	}
				    },
			        axisLabel: {
			            textStyle: {
			                color: '#EEE',
			                fontSize:14
			            }
			        }
			    },
			    series: [
			        {
			            name: seriesName[0],
			            type: 'bar',
			            label: {
			                normal: {
			                    show: true,
			                    formatter:function(obj){
			                        var c = (seriesData[0]/(Math.floor(seriesData[0])+Math.floor(seriesData[1])))*100;
			                        c = c.toFixed(2);  
			                        return seriesName[0]+':'+seriesData[0]+'\n'+c+"%";
			                    },
			                    position: 'insideRight'
			                }
			            },
			            data: seriesData[0]
			        },
			        {
			            name: seriesName[1],
			            type: 'bar',
			            label: {
			                normal: {
			                    show: true,
			                    formatter:function(obj){
			                        var c = (seriesData[1]/(Math.floor(seriesData[0])+Math.floor(seriesData[1])))*100;
			                        c = c.toFixed(2);  
			                        return seriesName[1]+':'+seriesData[1]+'\n'+c+"%";
			                    },
			                    position: 'insideRight'
			                }
			            },
			            data: seriesData[1]
			        }
			    ]
			};
			chart.setOption(option);
		}
		
		function common(option){
			var text = option.text,
				seriesData = option.seriesData;
			
			var chartWrapperId = option.chartWrapperId,
			chart = echarts.init(document.getElementById(chartWrapperId)),
			option = {
			    title: {
			        text: text,
			        x: 'center',
			        y: 'center',
			        textStyle: {
			            fontWeight: 'normal',
			            fontSize: 25,
			            color: '#EEE'
			        }
			    },
			    tooltip: {
			        show: true,
			        trigger: 'item',
			        formatter: "{b}: <br /> {c} ({d}%)"
			    },
			    series: [{
			        type: 'pie',
			        selectedMode: 'single',
			        radius: ['35%', '68%'],
			        color: ['#CA8622','#C23531','#61A0A8','#6A1512','#666633'],
			                /*'rgba(203,43,1,0.7)','rgba(242,97,25,0.7)','rgba(40,129,230,0.7)','rgba(255,171,0,0.7)','rgba(125,190,10,0.7)'*/
			        label: {
			            normal: {
			                position: 'inner',
			                formatter: '{b}',
			                textStyle: {
			                    color: '#eee',
			                    fontWeight: 'bold',
			                    fontSize: 14
			                }
			            }
			        },
			        labelLine: {
			            normal: {
			                show: false
			            }
			        },
			        data: seriesData
			    }, {
			        type: 'pie',
			        radius: ['68%', '93%'],
			        itemStyle: {
			            normal: {
			                color: 'rgba(55,55,55,1)'
			            },
			            emphasis: {
			                color: 'rgba(55,55,55,0.7)'
			            }
			        },
			        label: {
			            normal: {
			                position: 'inner',
			                formatter: '{d}%',
			                textStyle: {
			                    color: '#eee',
			                    fontWeight: 'bold',
			                    fontSize: 16
			                }
			            }
			        },
			        data: seriesData
			    }]
			};
			chart.setOption(option);
		}
		
		//内容包含在内的环状图
		function count(option){
			var legendData = option.legendData,
			seriesName1 = option.seriesName1,
			seriesName2 = option.seriesName2,
			seriesData1 = option.seriesData1,
			seriesData2 = option.seriesData2;
			var chartWrapperId = option.chartWrapperId,
			chart = echarts.init(document.getElementById(chartWrapperId)),
			option = {
				legend: {
			        data: legendData,
			        align: 'left',
			        left: 10,
			        textStyle: {
	             	   color: "#EEE",
	             	  fontSize:14
			        }
			    },
				tooltip: {
			        trigger: 'item',
			        formatter: "{b}: <br /> {c} ({d}%)"
			    },
			    series: [{
			         center: ["50%","50%"],
			         radius: ["59%","60%"],
			         clockWise: false,
		             type: "pie",
			         itemStyle: {
			             normal: {
			                label: {
			                   show: true,
			                   textStyle: {
			                      color: "#EEE",
			                      fontSize: 20,
			                      fontWeight: "bold"
			                    }
			                  },
			                  labelLine: {"show": false},
			                  color: "#17407A",
			                  borderColor: "#17407A",
			                  borderWidth: 30
			              }
			          },
			          data: [{
			             value:seriesData1, 
			             name: seriesName1,
			             label: {
			               normal: {
			            	   position: "center",
				               formatter: '已培训人数\n\n {c}  ({d}%)',
				               textStyle: {
				                 fontSize: 25
				               }
			               }
			            }
			          },
			          {
			           name: seriesName2,
			           value: seriesData2,
			           itemStyle: {
			              normal: {
			                 label: {"show": false},
			                 labelLine: {"show": false},
			                 color: "#17407A",
			                 borderColor: "#17407A",
			                 borderWidth: 1
			               }
			            }
			          }
			         ]
			        }
			      ]
			    };
			chart.setOption(option);
		}
	
		function init(){
			var wh = Math.floor(document.body.clientWidth*0.25)-5;
			var w = Math.floor(document.getElementById('tcm_left').clientWidth)-30;
			$('.left-div').css({'height':(w+30)*0.68});
			$('#tcm_right_div_1').css({'height':wh*1.2});
			$('#tcm_nav_right').css({'height':wh*0.9});
			$('.tcm-brand-title').html('中医馆数量:');
			orange.titleBrand('12821','tcm_brand_num');
			
			//云南地图
			orange.loadPage({url: 'system/ynMap.service', target: 'tcm_ynMap_div', selector: '#yn_map_div', replace: true, success: function(response) {	//	渲染左部导航模块
				
			}});
			
			//中医馆年度数据分析
			orange.loadPage({url: 'system/tcmAnnual.service', target: 'tcm_left_div_1', selector: '#tcm_annual_div', replace: true, success: function(response) {	//	渲染左部导航模块
				
			}});
			//中医馆诊疗人次
			orange.loadPage({url: 'system/tcmClinic.service', target: 'tcm_left_div_2', selector: '#tcm_clinic_div', replace: true, success: function(response) {	//	渲染左部导航模块
						
			}});
			orange.loadPage({url: 'system/tcmRank.service', target: 'tcm_left_div_3', selector: '#tcm_rank_div', replace: true, success: function(response) {	//	渲染左部导航模块
				
			}});
			orange.loadPage({url: 'system/tcmMuseum.service', target: 'tcm_right_div_1', selector: '#tcm_museum_div', replace: true, success: function(response) {	//	渲染左部导航模块
				
			}});
			//实施进度
			orange.loadPage({url: 'system/tcmProgress.service', target: 'tcm_progress_div', selector: '#progress_div', replace: true, success: function(response) {	//	渲染左部导航模块
				
			}});
		}
		
		return {
			barOrLine: barOrLine,	//柱状或线性单个
			barAndLine: barAndLine,	//柱状和线性组合
			pie: pie,	//饼
			annular: annular,	//环
			rect: rect,	//矩形
			area: area,	//面积
			PNBars: PNBars,	//正负条形图
			scatters: scatters,
			singleAxisScatters: singleAxisScatters,
			nestLoop: nestLoop, /*嵌套环形图*/
			bar:bar,//对比柱状图
			progressBar:progressBar,//进度条
			init : init,
			common: common ,  //常见病
			count : count//圆环内部包含文字
		};
	});
})();
